<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .active{
      background-color: rgb(201, 32, 32);
    }
    .box1{
      width:200px;
      height: 200px;
      border:1px solid #ccc;
      font-size: 30px;
      text-align: center;
      line-height: 200px;
      display: none;
    }
  </style>
</head>
<body>
  <input type="button" class="active" value="1">
  <input type="button" value="2">
  <input type="button" value="3">
  <div class="box1" style="display: block;">1</div>
  <div class="box1">2</div>
  <div class="box1">3</div>
  <script>
    var btns = document.querySelectorAll("input");
    var divs = document.querySelectorAll(".box1");
    for(var i=0;i<btns.length;i++){
      btns[i].index = i;
      btns[i].onclick = function(){
        for(var i=0;i<btns.length;i++){
          btns[i].classList.remove("active");
          divs[i].style.display="none";
        }
        this.classList.add("active");
        divs[this.index].style.display="block";
      }
    }
  </script>
</body>
</html>